list comprehensions hackerrank solution in python